add_executable(run_tests
        test_parser.cpp
        test_e2e.cpp
        ../src/ASTVisitor.cpp
)

target_compile_definitions(run_tests PRIVATE
        SOURCE_DIR="${CMAKE_SOURCE_DIR}"
)


target_sources(run_tests PRIVATE
        ${GENERATED_ANTLR_DIR}/DecafLangLexer.cpp
        ${GENERATED_ANTLR_DIR}/DecafLangParser.cpp
        ${GENERATED_ANTLR_DIR}/DecafLangBaseVisitor.cpp
        ${GENERATED_ANTLR_DIR}/DecafLangVisitor.cpp
)

target_include_directories(run_tests PRIVATE
        ${CMAKE_SOURCE_DIR}/src
        ${GENERATED_ANTLR_DIR}
        ${googletest_SOURCE_DIR}/googletest/include
        /opt/homebrew/opt/antlr4-cpp-runtime/include
        /opt/homebrew/opt/antlr4-cpp-runtime/include/antlr4-runtime
        /opt/homebrew/opt/llvm@17/include
)

target_link_libraries(run_tests PRIVATE
        gtest_main
        antlr4-runtime
        ${LLVM_LIBS}
)

add_dependencies(run_tests antlr_generate_${ANTLR_GRAMMAR_NAME})

include(GoogleTest)
gtest_discover_tests(run_tests)
